# Copyright (c) Meta Platforms, Inc. and affiliates.

# @noautodeps
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbcode_macros//build_defs:cpp_unittest.bzl", "cpp_unittest")
load("../../../defs.bzl", "zs_fuzzers")

oncall("data_compression")

cpp_library(
    name = "json_extract_test_data",
    headers = ["json_extract_test_data.h"],
    exported_deps = [
        "//folly:dynamic",
        "//folly:json",
    ],
)

cpp_unittest(
    name = "test_json_extract",
    srcs = ["test_json_extract.cpp"],
    deps = [
        "..:json_extract",
        "../../..:zstronglib",
        "../../../tools:zstrong_cpp",
        ":json_extract_test_data",
    ],
)

zs_fuzzers(
    srcs = [
        "fuzz_json_extract.cpp",
    ],
    ftest_names = [
        ("JsonExtractTest", "FuzzRoundTrip"),
        ("JsonExtractTest", "FuzzDecompress"),
    ],
    deps = [
        "..:json_extract",
        "../../../tests:fuzz_utils",
        "../../../tools:zstrong_cpp",
        "fbsource//xplat/security/lionhead/utils/lib_ftest:lib",
        ":json_extract_test_data",
    ],
)
